import request from '@/api/request'

// 获取订单列表
export function requestOrderList(info, data) {
  return request({
    method: 'post',
    url: `/lejuAdmin/order/findOrdersByPage/${info.start}/${info.limit}`,
    data
  })
}

// 获取订单详情
export function requestOrderInfo(id) {
  return request({
    method: 'get',
    url: `/lejuAdmin/order/orderDetail/${id}`
  })
}

// 获取退单列表
export function requestReturnList(info, data) {
  return request({
    method: 'post',
    url: `/lejuAdmin/orderReturn/findReturnApply/${info.start}/${info.limit}`,
    data
  })
}

// 获取退单详情
export function requestReturnInfo(id) {
  return request({
    method: 'get',
    url: `/lejuAdmin/orderReturn/${id}`
  })
}

// 获取地址列表
export function requestAddressList() {
  return request({
    method: 'get',
    url: `/lejuAdmin/companyAddress/addressList`
  })
}

// 获取地址明细
export function requestAddressInfo(id) {
  return request({
    method: 'get',
    url: `/lejuAdmin/companyAddress/${id}`
  })
}

// 设置默认收货地址
export function setReceiveOne(data) {
  return request({
    method: 'post',
    url: `/lejuAdmin/companyAddress/setReceiveOne`,
    data
  })
}

// 设置默认发货地址
export function setSendOne(data) {
  return request({
    method: 'post',
    url: `/lejuAdmin/companyAddress/setSendOne`,
    data
  })
}

// 删除地址
export function deleteAddress(id) {
  return request({
    method: 'delete',
    url: `/lejuAdmin/companyAddress/${id}`
  })
}

// 新增地址
export function addAddress(data) {
  return request({
    method: 'post',
    url: `/lejuAdmin/companyAddress/save`,
    data
  })
}

// 更新地址
export function updataAddress(data) {
  return request({
    method: 'post',
    url: `/lejuAdmin/companyAddress/update`,
    data
  })
}

// 确认发货
export function sendDone(data) {
  return request({
    method: 'post',
    url: `/lejuAdmin/order/sendDone`,
    data
  })
}

// 关闭订单
export function finishOrder(id) {
  return request({
    method: 'post',
    url: `/lejuAdmin/order/finishOrder/${id}`
  })
}

// 强制收货
export function receiveProductsForce(id) {
  return request({
    method: 'post',
    url: `/lejuAdmin/order/receiveProductsForce/${id}`
  })
}

// 同意退单
export function agreeReturn(id, data) {
  return request({
    method: 'post',
    url: `/lejuAdmin/orderReturn/agreeApply/${id}`,
    data
  })
}

// 拒绝退单
export function disAgreeReturn(id, data) {
  return request({
    method: 'post',
    url: `/lejuAdmin/orderReturn/agreeApply/${id}`,
    data
  })
}

// 收到退单
export function receiveReturn(id, data) {
  return request({
    method: 'post',
    url: `/lejuAdmin/orderReturn/receiveProduct/${id}`,
    data
  })
}
